Skip to main content

All Questions

1vote
2answers
87views

Filter for arbitrary AND patterns [duplicate]

Consider a command which takes arguments like this: cmd foo bar baz [arbitrary args...]. How do you build a filter of AND patterns based on those arguments? Something like this pipeline of greps: grep ...
mbigras's user avatar
  • 3,422
2votes
1answer
448views

How to find keywords in multiple files which often appear together?

I want to find keywords, which often occur in relation to each other. Example A directory contains markdown files, each with some keywords on the last line: $ tail -n 1 file1.md #doctor #donkey #...
user avatar
7votes
3answers
10kviews

Grep lines that match pattern twice

Usually grep outputs any lines that match a pattern. I want to be able to find lines that match the pattern multiple times. For example, if my search pattern was "foo", then: foo bar #...
Questionmark's user avatar
1vote
3answers
710views

one shell command to find every n-gram works in text

I have a text stream or a file that contains words separated by whitespace.  Like: I have a toy. you may not like it. Every whitespace-separated word may be composed by two or more small words, maybe ...
John Chen's user avatar
2votes
2answers
295views

I want to extract particular column from the file, column number is given in different file using shell scripting?

I want to extract particular column from the file1 by comparing with file2 in which column number is given that should be extracted from file1. File 1 (source data) look like this: 1 2 3 4 5 ...
claudia smith's user avatar
1vote
2answers
4kviews

Concatenate a string with a variable in grep command

I have to search by this pattern: _20181106 20181106 is yesterdays date, so it has to be be a variable like TZ=aaa24 date +%Y%m%d How can I search a file with this pattern? I'm working with AIX
Tarek Sayed's user avatar
0votes
4answers
3kviews

Grep a pattern from a file and get that whole word, not just the pattern

List item I/P: abcd_Server1 CCDDomain defg_Server1 GGFDomain kdkhs_Server1 CCDDomain abce_Server1 CCDDomain dgdg_Server1 CCADomain dfdkhs_Server1 GGFDomain I need to search for the word "Domain" and ...
Aditya Telang's user avatar
1vote
3answers
4kviews

How to count occurrences of each word belonging to a file in all of `n` number of files passed as arguments?

I am looking for a shell script that accepts a list of file names as its arguments, counts and reports the occurrence of each word that is present in the first argument file on other argument files. ...
The Room's user avatar
3votes
3answers
37kviews

grep with line breaks

I have got large 200 MB mail history text file and I have to find a line that has the following structure: lastname name streetname numberOfHouse postalcode cityname namely: Arthur Dent Galaxy 7 ...
jublikon's user avatar
2votes
3answers
3kviews

awk string match from 2 columns

I have a file (file 1) which reads something like this: 2 test1 3 test2 2 test3 1 test1 4 test2 And there is a master file (file2): 2 test1 3 test1 4 test1 2 test2 3 test2 4 ...
Ash's user avatar
  • 21
0votes
2answers
688views

How to get path, row index and content of row in bash shell?

I have a file and I want search some text in this file and export path of file, row index of content iIsearched and content of row. I use this command: grep -rnw 'path-file' -e 'patter' but the ...
Vương Vũ's user avatar
18votes
5answers
10kviews

Find files that contain multiple keywords anywhere in the file

I'm looking for a way to list all files in a directory that contain the full set of keywords I'm seeking, anywhere in the file. So, the keywords need not to appear on the same line. One way to do ...
arekolek's user avatar
-2votes
2answers
158views

Find all line in a file which start with g or any digit from 0to9

How do I find all lines in a file which start with g or any digit from 0 to 9? Can any one help me using command line? I try and I know how to do if start with g but don't know how to do with g and 0 ...
Jaimin's user avatar
1vote
3answers
327views

Elegant way of counting how many times patterns from a file occur in another file

Imagine that we have two for example files. The first file is filled with unique names of employees created by combining the first two characters of the first name and the last 2 characters of the ...
pnom's user avatar
  • 297
4votes
2answers
478views

How Do I Remove Duplicate Words With Suffixes?

How do I compare a list of unsorted words of variable length and remove duplicate words that have a suffix? Example word list: iron curl curled railroad curler ...
J363's user avatar
  • 500

153050per page
close